package com.iraeta.service.impl;

import com.iraeta.dao.UserDao;
import com.iraeta.entity.User;
import com.iraeta.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class UserServiceImpl implements UserService {
    @Resource
    UserDao userDao;

    @Override
    public User getUser(int id) {
        return userDao.selectByPrimaryKey(id);
    }

    @Override
    public void addUser(User user) {
        userDao.insert(user);
    }

    @Override
    public void updateUser(User user) {
        userDao.updateByPrimaryKey(user);
    }

    @Override
    public void deleteUser(int id) {
        userDao.deleteByPrimaryKey(id);
    }

    @Override
    public User getUserByUserName(String userName, String pwd) {
        return userDao.selectUserByUserName(userName, pwd);
    }
}
